#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000, mod = 1000000007;
const double eps = 0.000001;
int main() {
  int n, m, res = 0;
  cin >> n >> m;
  vector<bool> a(n, true);
  for (int cc = 0; cc < m; cc++) {
    string s, t;
    int x;
    cin >> s >> s >> s >> t >> x;
    x--;
    a[x] = false;
    if (s == "right") {
      for (int i = x - 1; i >= 0; i--) a[i] = false;
    } else {
      for (int i = x + 1; i < n; i++) a[i] = false;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i]) res++;
  }
  if (res != 0)
    cout << res;
  else
    cout << -1;
  return 0;
}
