#include <bits/stdc++.h>
using namespace std;
int n, m, len;
char str1[100000], str2[100000], str3[100000], str4[100000], buffer[100000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int i, j, k, t;
  scanf("%d%d", &n, &m);
  getchar();
  int l = 0, r = n - 1;
  int imposs = 0;
  while (m--) {
    int a, b;
    gets(buffer);
    sscanf(buffer, "%s%s%s%s%d", str1, str2, str3, str4, &a);
    a--;
    if (strcmp(str3, "left") == 0) {
      if (a - 1 < r) r = a - 1;
    } else if (strcmp(str3, "right") == 0) {
      if (a + 1 > l) l = a + 1;
    }
    if (l > r) {
      imposs = 1;
      break;
    }
  }
  if (imposs)
    cout << -1 << "\n";
  else
    cout << r - l + 1 << "\n";
  return 0;
}
