Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n, m := io.NextInt(), io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
		}
		ans := 0
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				if a[i]+a[j] <= m {
					ans = intMax(a[i]+a[j], ans)
				}
			}
		}
		if ans == 0 {
			io.Println("NONE")
		} else {
			io.Println(ans)
		}
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2,gcd
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

ans=[]

while 1:
    n,m=MAP()
    if n==0 and m==0:
        break
    else:
        a=LIST()
        
        lis=[sum(x) for x in list(combinations(a,2)) if sum(x)<=m]
        if not lis:
            ans.append('NONE')
        else:
            ans.append(max(lis))

for x in ans:
    print(x)

Python: while True:
    N, M = map(int, input().split())
    if N == 0 and M == 0:
        break
    A = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        for j in range(N):
            if i == j:
                pass
            elif M >= A[i] + A[j]:
                ans = max(A[i] + A[j], ans)
    if ans == 0:
        print("NONE")
    else:
        print(ans)

Python: answer=[]
while True:
    t = 0
    n,m = map(int,input().split())
    if n != 0:
        a = list(map(int,input().split()))
        a.sort()
        for i in range(n - 1):
            k = a[-i-1]
            for j in range(n - i - 1):
                if k + a[-i-j-1] <= m:
                    if k + a[-i-j-1] >= t:
                        t = k + a[-i-j-1]
                    break
        if t == 0:
            answer.append("NONE")
        else:
            answer.append(t)
    else:
        break
for i in range(len(answer)):
    print(answer[i])

Python: n,m=map(int,input().split())
a=[0]*n
a=list(input().split())
for i in range(n):
    a[i]=int(a[i])
max=0
for i in range(n):
    for j in range(n):
        if i<j:
            tmp=a[i]+a[j]
            if tmp>max and tmp<=m:
                max=tmp
            else: pass
        else: pass
if max==0:
    print("NONE")
else:
    print(max)

Python: while True:
    (n,m) = map(int,input().split())
    if n == 0 and m == 0:
        break
    iss = list(map(int, input().split()))
    best = max([ (iss[i] + iss[j] if not ( i == j) and iss[i] + iss[j] <= m else -1) for i in range(0,n) for j in range(0,n) ])
    if(best < 0):
        print("NONE")
    else:
        print(best)

Python: answer=[]
while True:
    t = 0
    n,m = map(int,input().split())
    if n != 0:
        a = list(map(int,input().split()))
        a.sort()
        for i in range(n - 1):
            k = a[-i-1]
            for j in range(n - i):
                if k + a[-i-j-1] <= m:
                    if k + a[-i-j-1] >= t:
                        t = k + a[-i-j-1]
                    break
        if t == 0:
            answer.append("NONE")
        else:
            answer.append(t)
    else:
        break
for i in range(len(answer)):
    print(answer[i])

Python: 

n,m=map(int,raw_input().split())

while n>0 and m>0:
    ok=0
    list=map(int,raw_input().split())
    if list[0]<m:
        max=list[0]
    for j in range(len(list)-1):
        for k in range(1,len(list)):
            tmp=list[j]+list[k]
            if tmp>max and tmp<=m:
                ok=1
                max=tmp
    if ok==1:
        print(max)
    else:
        print("NONE")
    n,m=map(int,raw_input().split())

Python: while 1:
    n, m = map(int, input().split())
    if n == 0:
        break

    a = list(map(int, input().split()))

    ans = 0
    for i in range(n):
        for j in range(i+1, n):
            if m < a[i] + a[j]:
                continue

            ans = max(ans, a[i] + a[j])

    if ans == 0:
        print("NONE")
    else:
        print(ans)

Python: while 1:
    n,m = map(int,input().split())
    if n==0:break
    a = list(map(int,input().split()))
    c = []
    for i in range(n-1):
        for j in range(i+1, n):
            if a[i]+a[j] <= m:
                c.append(a[i]+a[j])
    if len(c) == 0:
        print('NONE')
    else:
        print(max(c))

Python: while True:
    n,m = map(int,input().split());
    if n == 0 and m == 0:
        break;
    B = list(map(int, input().split()));

    sum = 0;
    for i in range(0,n):
        for j in range(0,n):
            if i != j:
                if m >= B[i]+B[j]:
                    if sum <= B[i]+B[j]:
                        sum = B[i]+B[j];

    if sum == 0:
        print("NONE");
    else:
        print(sum);

Python: while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        exit()
    A = list(map(int, input().split()))
    ans = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if ans < A[i] + A[j] <= m:
                ans = A[i] + A[j]
    print(ans if ans != 0 else 'NONE')

Python: n,m=input().split()
n=(int)(n)
m=(int)(m)


B=[]
cnt=0
while n!=0 and m!=0:
    A=input().split()
    cnt=0
    max=0
    for i in range(n):
        A[i]=(int)(A[i])
    for i in range(n):
        for j in range(i+1,n):
            x=A[i]+A[j]
            if x>max and x<=m:
                max=x
    if max>0:
        B.append(max)
    else:
        B.append('NONE')
    cnt+=1
    n,m=input().split()
    n=(int)(n)
    m=(int)(m)

for i in range(len(B)):
    print(B[i])