#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  int dau, cuoi;
  dau = 1;
  cuoi = n;
  for (int i = (int)0; i < (int)m; i++) {
    pair<char, int> h;
    string s, tmp;
    int a;
    cin >> s >> s >> s >> tmp >> a;
    if (s[0] == 'r') {
      if (a >= cuoi) {
        cout << -1;
        return 0;
      } else if (a >= dau)
        dau = a + 1;
    }
    if (s[0] == 'l') {
      if (a <= dau) {
        cout << -1;
        return 0;
      } else if (a <= cuoi)
        cuoi = a - 1;
    }
  }
  cout << cuoi - dau + 1;
  return 0;
}
