#include <bits/stdc++.h>
using namespace std;
string toStr(long long n) {
  string r;
  stringstream ss;
  ss << n;
  ss >> r;
  return r;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> mask(n, true);
  for (int i = 0; i < m; i++) {
    string tmp1, tmp2, dir, tmp3;
    int indx;
    cin >> tmp1 >> tmp2 >> dir >> tmp3;
    cin >> indx;
    if (dir == "right") {
      for (int l = indx - 1; l >= 0; l--) mask[l] = false;
    } else if (dir == "left") {
      for (int r = indx - 1; r < n; r++) mask[r] = false;
    }
  }
  int s2 = 0;
  for (int i = 0; i < n; i++)
    if (mask[i] == true) s2++;
  if (s2 == 0)
    cout << -1 << endl;
  else
    cout << s2 << endl;
  return 0;
}
