#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  bool can_be[1005];
  int i;
  for (i = 1; i <= n; i++) can_be[i] = true;
  while (m--) {
    string s, t;
    cin >> s;
    cin >> s;
    cin >> s;
    cin >> t;
    int k;
    cin >> k;
    if (s == "left") {
      for (i = k; i <= n; i++) can_be[i] = false;
    }
    if (s == "right") {
      for (i = 1; i <= k; i++) can_be[i] = false;
    }
  }
  int s = 0;
  for (i = 1; i <= n; i++) {
    if (can_be[i]) s++;
  }
  if (s < 1) s = -1;
  cout << s << endl;
  return 0;
}
