#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, num;
  string s, dir;
  cin >> n >> m;
  int l = 0, r = n + 1;
  for (int i = 0; i < m; i++) {
    cin >> s >> s >> dir >> s >> num;
    if (dir == "right") l = max(l, num);
    if (dir == "left") r = min(r, num);
  }
  int ans = r - l - 1;
  if (ans <= 0)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
