#include<bits/stdc++.h>
const int N=1010;
using namespace std;
int a[N],c[N],n,m;
inline int read()
{
int f=1,x=0;char ch;
do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
return f*x;
}
int main()
{
n=read();m=read();
for(int i=1;i<=n;i++)a[i]=read();
for(int i=1;i<=n;i++)c[a[i]]++;
while(m--){
int opt=read(),x=read();
if(opt==1)c[x]--;
if(opt==2)printf("%d\n",c[x]);
}
return 0;
}
const int N=1010;
using namespace std;
int a[N],c[N],n,m;
inline int read()
{
int f=1,x=0;char ch;
do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
return f*x;
}
int main()
{
n=read();m=read();
for(int i=1;i<=n;i++)a[i]=read();
for(int i=1;i<=n;i++)c[a[i]]++;
while(m--){
int opt=read(),x=read();
if(opt==1)c[x]--;
if(opt==2)printf("%d\n",c[x]);
}
return 0;
}