#include <bits/stdc++.h>
using namespace std;
int A[1002];
int main() {
  int n, m, l = 1, r;
  string s1, s2, s3, s4, s5;
  cin >> n >> m;
  r = n;
  while (m--) {
    cin >> s1 >> s2 >> s3 >> s4 >> s5;
    stringstream ss;
    ss.clear();
    ss << s5;
    int x;
    ss >> x;
    if (s3 == "left") {
      if (x == 1) {
        puts("-1");
        return 0;
      }
      if (r <= x - 1) continue;
      if (r > x - 1 && l <= x - 1)
        r = x - 1;
      else {
        puts("-1");
        return 0;
      }
    } else {
      if (x == n) {
        puts("-1");
        return 0;
      }
      if (l >= x + 1) continue;
      if (l < x + 1 && r >= x + 1)
        l = x + 1;
      else {
        puts("-1");
        return 0;
      }
    }
  }
  cout << r - l + 1 << endl;
  return 0;
}
