#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> hints(m);
  cin.ignore();
  for (int i = 0; i < m; i++) getline(cin, hints[i]);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    bool ok = true;
    for (int j = 0; j < m; j++)
      if (hints[j][7] == 'r') {
        int toRight;
        sscanf(hints[j].c_str() + 16, "%d", &toRight);
        ok &= i > toRight;
      } else {
        int toLeft;
        sscanf(hints[j].c_str() + 15, "%d", &toLeft);
        ok &= i < toLeft;
      }
    if (ok) ans++;
  }
  cout << (ans > 0 ? ans : -1) << '\n';
  return 0;
}
