#include <bits/stdc++.h>
using namespace std;
char ch[8];
int v[1001];
int n;
void umplere(int j, int p) {
  int i;
  if (p == 1) {
    for (i = j - 1; i >= 1; i--) v[i]++;
  } else {
    for (i = j + 1; i <= n; i++) v[i]++;
  }
}
int main() {
  int i, m, p, j, maxim1 = 0, x;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> ch + 1;
    cin >> ch + 1;
    cin >> ch + 1;
    if (ch[1] == 'l')
      p = 1;
    else
      p = 0;
    cin >> ch + 1;
    cin >> j;
    umplere(j, p);
  }
  for (i = 1; i <= n; i++) {
    if (v[i] == m) maxim1++;
  }
  if (maxim1 > 0) cout << maxim1;
  if (maxim1 == 0) cout << -1;
  return 0;
}
