#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t, minl = 10000, maxr = -1, res;
  cin >> n >> m;
  string temp, lr;
  for (int i = 0; i < m; i++) {
    cin >> temp >> temp >> lr >> temp >> t;
    if (lr == "left") {
      minl = min(minl, t);
    } else {
      maxr = max(maxr, t);
    }
  }
  res = n;
  if (maxr > 0) res -= maxr;
  if (minl <= n) res -= (n - minl + 1);
  if (res <= 0)
    cout << -1;
  else
    cout << res;
  return 0;
}
