#include <bits/stdc++.h>
using namespace std;
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }
  friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt<mod> &a) {
    long long x;
    is >> x;
    a = ModInt<mod>(x);
    return (is);
  }
};
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }
  bool find(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
  bool united() {
    int comroot = -1;
    for (register int64_t i = 0; i < (int64_t)data.size(); i++) {
      if (comroot != -1 && root(i) != comroot) return false;
      comroot = root(i);
    }
    return true;
  }
};
static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}
static inline int64_t rs64() {
  int64_t a;
  scanf("%" SCNd64, &a);
  return a;
}
static inline void wi(int a) { printf("%d", a); }
static inline void wu64(uint64_t a) { printf("%" PRIu64, a); }
static inline void ws64(int64_t a) { printf("%" PRId64, a); }
int int_less(const void *a, const void *b) {
  return (*((const int *)a) - *((const int *)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int *)b) - *((const int *)a));
}
int main() {
  int n = ri();
  int x = ri();
  int a[n];
  for (register int64_t i = 0; i < (int64_t)(sizeof(a) / sizeof(*a)); i++)
    a[i] = ri();
  qsort(a, (sizeof(a) / sizeof(*a)), sizeof(*a), int_less);
  int res = 0;
  int i = 0;
  while (1) {
    if (i == n - 1) {
      cout << x << endl;
      if (x == a[i]) res++;
      break;
    }
    if (x >= a[i])
      x -= a[i], res++;
    else
      break;
    if (x <= 0) break;
    i++;
  }
  cout << res << endl;
  return 0;
}
