#include <bits/stdc++.h>
using namespace std;
int num[1001];
int main() {
  int k, i, a, counter = 0, n, m, left, right;
  string str1, str2, str3, str4;
  cin >> n >> m;
  left = 1;
  right = n;
  for (i = 0; i < m; i++) {
    cin >> str1 >> str2 >> str3 >> str4 >> a;
    if (str3 == "left" && right > a - 1) right = a - 1;
    if (str3 == "right" && left < a + 1) left = a + 1;
  }
  if (right - left + 1 <= 0)
    cout << "-1" << endl;
  else
    cout << right - left + 1 << endl;
  return 0;
}
