#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* const argv[]) {
  string t, dir;
  int num;
  int s, f;
  int n, m;
  cin >> n >> m;
  s = 1;
  f = n;
  for (int i = 0; i < m; i++) {
    cin >> t >> t >> dir >> t >> num;
    if (dir == "left" && num - 1 < f) {
      f = num - 1;
    }
    if (dir == "right" && num + 1 > s) {
      s = num + 1;
    }
    if (s > f) {
      cout << -1;
      return 0;
    }
  }
  cout << f - s + 1;
  return 0;
}
