#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  string ch, ch2;
  cin >> n >> m;
  int mini = 1, maxi = n;
  for (int i = 1; i <= m; i++) {
    cin >> ch >> ch >> ch2 >> ch >> x;
    if (ch2 == "right")
      mini = max(mini, x + 1);
    else
      maxi = min(maxi, x - 1);
  }
  if (maxi < mini)
    cout << -1 << endl;
  else
    cout << maxi - mini + 1 << endl;
  return 0;
}
