#include <bits/stdc++.h>
using namespace std;
bool b[1001];
int main() {
  string str;
  int n, k;
  cin >> n >> k;
  int left = n + 1, right = 0;
  for (int i = 0; i < k; i++) {
    string str1;
    bool flag = true;
    cin >> str1;
    cin >> str1;
    cin >> str1;
    if (str1 == "left")
      flag = true;
    else
      flag = false;
    cin >> str1;
    int c;
    cin >> c;
    if (flag)
      left = min(left, c);
    else
      right = max(right, c);
  }
  if (right + 1 >= left)
    cout << -1 << '\n';
  else
    cout << left - right - 1;
  return 0;
}
