#include <iostream>
#include<vector>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,q;
	cin>>n>>q;
	vector<int>freq(n+1,0);
	while(q--){
		int x,z;
		cin>>x>>z;
		if(x==1){
		freq[z]++;}
		else if(x==2){
		cout<<freq[z]<<endl;}
	}
}