#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, d, l, r;
  string s, t;
  while (cin >> n >> m) {
    l = 1, r = n;
    for (i = 1; i <= m; i++) {
      cin >> t >> t >> s >> t >> d;
      if (s == "left")
        r = min(r, d - 1);
      else
        l = max(l, d + 1);
    }
    if (l <= r)
      cout << r - l + 1 << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
