#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main(void) {
  int N, A;
  cin >> N >> A;
  int min = 1001, max = -1;
  for (int i = 1; i <= N; i++) {
    if (min > A) min = A;
    if (max < A) max = A;
  }
  cout << max - min << endl;
  return 0;
}
