#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int lo = 1, hi = n, x;
  for (string a, b; cin >> a >> a >> a >> b >> x;
       a == "left" ? hi = min(x - 1, hi) : lo = max(x + 1, lo))
    ;
  cout << (lo > hi ? -1 : hi - lo + 1);
}
