#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    cout << n << "\n";
    return 0;
  }
  string hint[m];
  getline(cin, hint[0]);
  vector<vector<string> > h(m);
  for (int i = 0; i < m; i++) {
    getline(cin, hint[i]);
    stringstream ss(hint[i]);
    string w;
    while (ss >> w) h[i].push_back(w);
  }
  int i;
  int ans = 0;
  for (i = 0; i < n; i++) {
    bool yes = true;
    for (int j = 0; j < m; j++) {
      if (h[j][2] == "left") {
        int k = atoi(h[j][4].c_str()) - 1;
        if (i >= k) {
          yes = false;
          break;
        }
      } else if (h[j][2] == "right") {
        int k = atoi(h[j][4].c_str()) - 1;
        if (i <= k) {
          yes = false;
          break;
        }
      }
    }
    if (yes) ans++;
  }
  if (ans == 0) ans = -1;
  cout << ans << "\n";
  return 0;
}
