//below
#include<iostream>
#include<cmath>
#include<algorithm>
#define lli long long
using namespace std;
bool a[1000005];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,w,k;
    cin>>n>>w;
    a[0]=1;
    for(int j=0;j<n;j++)
    {
        cin>>k;
        for(int i=w;i>=0;i--)
        {
            if(a[i]){a[i+k]=1;}
        }
    }
    for(int i=w;i>=0;i--)
    {
        if(a[i]){cout<<i<<"\n";break;}
    }
    return 0;
}

