#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a = 1, b = 0;
  cin >> n >> m;
  b = n;
  for (int f = 0; f < (m); f++) {
    int pos;
    char s[100];
    scanf("%*s%*s%s%*s%d", s, &pos);
    if (s[0] == 'l') {
      if (pos - 1 < b) b = pos - 1;
    } else if (pos + 1 > a)
      a = pos + 1;
  }
  if (b - a + 1 > 0)
    cout << b - a + 1;
  else
    cout << "-1";
}
