#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int k = 1, j = n;
  for (int i = 0; i < m; i++) {
    string x[4];
    int v;
    for (int l = 0; l < 4; l++) cin >> x[l];
    cin >> v;
    if (x[2] == "left")
      j = min(j, v - 1);
    else if (x[2] == "right")
      k = max(k, v + 1);
  }
  if (k > j)
    cout << -1 << endl;
  else
    cout << j - k + 1 << endl;
  return 0;
}
