// اَللَهُمَ صَلِ عَلَىَ مُحَمَدٍ وَ آلِ مُحَمَدٍ
#include "bits/stdc++.h"
using namespace std ;
#define int long long
#define pb push_back
#define si size()
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define applejuice ios::sync_with_stdio(false) ; cin.tie(nullptr) ; cout.tie(nullptr) ;
const int inf=1e18 ;
const int mod=1e9+7 ;
const int maxn=2*1e5+7 ;
int tt=1 ;
map<int,bool> mp[maxn] ;
void solve() {
int n , q , cnt=0 ;
cin >> n >> q ;
while(q--) {
int x ;
cin >> x ;
if(x<0) {
mp[cnt][-x]=0 ;
}
else if(mp[cnt][x]) {
cnt+=1 ;
}
mp[cnt][x]=1 ;
}
cout << cnt ;
}
signed main() {
//wrong
applejuice ;
//cin >> tt ;
while(tt--) {solve() ;}
}