#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
const int base = 1000 * 1000 * 1000;
int main() {
  int n, m;
  cin >> n >> m;
  int l = 1, r = n;
  string str, str1, str2, str3;
  int t;
  for (int i = 0; i < m; i++) {
    cin >> str >> str1 >> str2 >> str3 >> t;
    if (str2 == "left") {
      if (t <= r) {
        r = t - 1;
      }
    } else {
      if (t >= l) {
        l = t + 1;
      }
    }
    if (l > r) {
      cout << -1;
      return 0;
    }
  }
  cout << r - l + 1;
  return 0;
}
