#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    cout << n << endl;
    return 0;
  }
  int left(10000), right(-1);
  string str, tmp;
  int d;
  while (m--) {
    cin >> tmp;
    cin >> tmp;
    cin >> str;
    cin >> tmp;
    cin >> d;
    if (str == "right") {
      if (d > right) right = d;
    } else {
      if (d < left) left = d;
    }
  }
  if (left == 10000) {
    if (right != n) {
      cout << n - right << endl;
    } else {
      cout << "-1" << endl;
    }
  } else if (right == -1) {
    if (left != 1) {
      cout << left - 1 << endl;
    } else {
      cout << "-1" << endl;
    }
  } else {
    if (left - right >= 2) {
      cout << left - right - 1 << endl;
    } else {
      cout << "-1" << endl;
    }
  }
  return 0;
}
