#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  int x = 1, y = n;
  cin.ignore();
  for (int i = 1; i <= m; i++) {
    string s = "";
    getline(cin, s);
    int t = 0;
    for (int j = s.find("of") + 3; j < s.size(); j++) {
      t = t * 10 + s[j] - '0';
    }
    if (s.find("left") != s.npos)
      y = min(y, t - 1);
    else
      x = max(x, t + 1);
  }
  int dem = 0;
  if (x > y) return cout << -1, 0;
  for (int i = x; i <= y; i++) dem++;
  cout << dem;
  return 0;
}
