#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int maxL = 1;
  int maxR = n;
  for (int i = 0; i < m; ++i) {
    string tt, dir;
    int ind;
    cin >> tt >> tt >> dir >> tt >> ind;
    if (dir[0] == 'r') {
      maxL = max(maxL, ind + 1);
    } else {
      maxR = min(maxR, ind - 1);
    }
  }
  if (maxR < maxL)
    cout << "-1" << endl;
  else
    cout << maxR - maxL + 1 << endl;
  return 0;
}
