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