#include <bits/stdc++.h>
using namespace std;
int g[9999];
int main() {
  int n, m, flag, a, cnt, f = 0, t;
  string s;
  cin >> n >> m;
  cnt = 0;
  t = m;
  while (m--) {
    for (int i = 0; i < 2; i++) cin >> s;
    cin >> s;
    if (s == "left")
      flag = 0;
    else
      flag = 1;
    cin >> s;
    cin >> a;
    f++;
    if (flag) {
      if (a == n) {
        cout << -1 << endl;
        return 0;
      }
      for (int i = a; i < n; i++) {
        g[i]++;
      }
    } else {
      if (a == 1) {
        cout << -1 << endl;
        return 0;
      }
      for (int i = 0; i < a - 1; i++) {
        g[i]++;
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (g[i] == t) {
      cnt++;
    }
  if (cnt)
    cout << cnt << endl;
  else
    cout << -1 << endl;
  return 0;
}
