#include <bits/stdc++.h>
using namespace std;
int main() {
  string buff, pos;
  int l = 1, r, n, num;
  cin >> r >> n;
  for (int i = 1; i <= n; i++) {
    cin >> buff >> buff >> pos >> buff >> num;
    if (pos == "left") r = ((r >= num) ? num - 1 : r);
    if (pos == "right") l = ((l <= num) ? num + 1 : l);
  }
  if (r >= l)
    cout << (r - l + 1);
  else
    cout << "-1";
}
